package com.cskaoyan.wordmemorize.controller.app;

import com.cskaoyan.wordmemorize.common.result.Result;
import com.cskaoyan.wordmemorize.dto.admin.GoodsDTO;
import com.cskaoyan.wordmemorize.dto.admin.PageDTO;
import com.cskaoyan.wordmemorize.request.GoodsPageRequest;
import com.cskaoyan.wordmemorize.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/product")
public class UserGoodsController {

    @Autowired
    GoodsService goodsService;

    @RequestMapping("")
    public Result<PageDTO<GoodsDTO>> getGoodsPage(GoodsPageRequest pageRequest){
        PageDTO<GoodsDTO> goodsPage = goodsService.getAllGoods(pageRequest);
        return Result.ok(goodsPage);
    }

}
